package Modules.Login
{
	import com.desidea.common.MenuConstants;
	
	public class LoginInfo
	{
		private var _response	:XML;
		private var _info		:Object;
		
		public function LoginInfo(response:XML){
			_response = response
			//Alert.show(_response.toString());
			_info = new Object();
			_info.RESULT 	= response.RESPONSE.RESULT;
			_info.MESSAGE 	= response.RESPONSE.MESSAGE;
		}
		
		public function get LoginID():String{
			return _response.LOGINID;
		}
		
		public function get UserId():String{
			return _response.USERID;
		}
		
		public function get FirstName():String{
			return _response.FIRSTNAME;
		}

		public function get LastName():String{
			return _response.LASTNAME;
		}
		////
		public function get CanCreateChildAccount():Boolean{
			return (_response.CANCREATECHILDACCOUNT == 'X' || _response.CANCREATECHILDACCOUNT=='1');
		}

		public function get CanDisplayChildAccount():Boolean{
			return (_response.CANDISPLAYCHILDACCOUNT == 'X' || _response.CANDISPLAYCHILDACCOUNT=='1');
		}
		
		//--
		public function get CanCreateContact():Boolean{
			return (_response.CANCREATECONTACT == 'X' || _response.CANCREATECONTACT=='1');
		}

		public function get CanDisplayContact():Boolean{
			return (_response.CANDISPLAYCONTACT == 'X' || _response.CANDISPLAYCONTACT=='1');
		}
		
		//--
		public function get CanCreateActivity():Boolean{
			return (_response.CANCREATEACTIVITY == 'X' || _response.CANCREATEACTIVITY=='1');
		}

		public function get CanDisplayActivity():Boolean{
			return (_response.CANDISPLAYACTIVITY == 'X' || _response.CANDISPLAYACTIVITY=='1');
		}
		
		//--
		public function get CanCreateTask():Boolean{
			return (_response.CANCREATETASK == 'X' || _response.CANCREATETASK=='1');
		}

		public function get CanDisplayTask():Boolean{
			return (_response.CANDISPLAYTASK == 'X' || _response.CANDISPLAYTASK=='1');
		}
		
		//--
		public function get CanCreateOpportunity():Boolean{
			return (_response.CANCREATEOPP == 'X' || _response.CANCREATEOPP=='1');
		}

		public function get CanDisplayOpportunity():Boolean{
			return (_response.CANDISPLAYOPP == 'X' || _response.CANDISPLAYOPP=='1');
		}
		////

		public function get IsAdministrator():Boolean{
			return (_response.ROLENAME == MenuConstants.ADMINISTRATOR);
		}
		
		public function get IsMAM():Boolean{
			return (_response.ROLENAME == MenuConstants.MAM);
		}
		
		public function get IsLeadGen():Boolean{
			return (_response.ROLENAME == MenuConstants.LEADGEN);
		}
		
		public function get IsDirector():Boolean{
			return (_response.ROLENAME == MenuConstants.DIRECTOR);
		}
		
		public function get CanCreateParentAccount():Boolean{
			return (_response.CANCREATEPARENTACCOUNT == 'X' || _response.CANCREATEPARENTACCOUNT=='1');
		}

		public function get CanEditProductMaster():Boolean{
			return (_response.CANEDITPRODUCTMASTER == 'X' || _response.CANEDITPRODUCTMASTER=='1');
		}

		public function get IsSuperUser():Boolean{
			return (_response.SUPERUSER == 'X' || _response.SUPERUSER=='1');
		}

		public function get Result():String{
			return _info.RESULT;
		}

		public function get Message():String{
			return _info.MESSAGE;
		}
		
	}
}